//仓库大仓库
import { createPinia } from 'pinia'
import persist from 'pinia-plugin-persistedstate'
// 创建大仓库
const pinia = createPinia().use(persist)

// pinia使用setup函数创建store $reset()失效  进行重写
pinia.use(({ store }) => {
  const initialState = JSON.parse(JSON.stringify(store.$state))
  store.$reset = () => {
    store.$patch(initialState)
  }
})

//对外暴露:入口文件需要安装仓库
export default pinia
